package com.ruoyi.project.system.mapper;

import com.ruoyi.project.system.domain.SmProduct;
import com.ruoyi.project.system.domain.vo.Option;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

/**
 * 产品Mapper接口
 */
public interface SmProductMapper {

    List<Option> selectId();

    List<String> img(String external);

    @Select("SELECT isThrEle FROM sm_product WHERE id = #{id}")
    String selectIsThrEle(Integer id);

    List<Integer> ids();

    @Insert("insert into sm_img (code, url, createTime) values (#{code}, #{url}, sysdate())")
    int addImg(String code, String url);

    @Update("update sm_img set status = #{status}, updateTime = sysdate() where id = #{id}")
    int updateImg(Integer id, String status);

    @Select("SELECT id, url, status FROM sm_img  WHERE `code` = #{external}")
    List<Map<String, String>> allImg(String external);

    @Delete("delete from sm_img where id = #{id}")
    int deleteImg(Integer id);

    List<Map<String, String>> distinctProductName();

    List<Map<String, String>> homePageProducts(@Param("homePage") String homePage);

    Integer productCount();

    /**
     * 查询产品
     *
     * @param id 产品主键
     * @return 产品
     */
    public SmProduct selectSmProductById(Integer id);

    List<SmProduct> selectSmProductList_();

    /**
     * 修改产品
     *
     * @param smProduct 产品
     * @return 结果
     */
    int updateSmProduct(SmProduct smProduct);

}
